/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rlpw.swing;

import java.util.List;

/**
 *
 * @author weinpau
 */
public class DefaultSelectModel<T> extends StateModel<T> implements SelectModel<T> {

    public DefaultSelectModel(View<T> view) {
        super(view);
    }

    public boolean isSelected(int index) {
        return getState(index);
    }

    public boolean isSelected(T element) {
        return getState(element);
    }

    public void setSelected(int index, boolean select) {
        setState(index, select);
    }

    public void setSelected(T element, boolean select) {
        setState(element, select);
    }

    public void setAllSelected(boolean select) {
        setAllState(select);
    }

    public List<T> getSelected() {
        return getStates();
    }

    public int countSelected() {
        return size();
    }
}
